//
//  CHWXQYCell.m
//  CarFile
//
//  Created by 陈浩 on 2018/3/7.
//  Copyright © 2018年 陈浩. All rights reserved.
//

#import "CHWXQYCell.h"

@interface CHWXQYCell()
@property (weak, nonatomic) IBOutlet UILabel *magorbrandsLabel;

@property (weak, nonatomic) IBOutlet UIImageView *headImgView;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UILabel *addressLabel;
@property (weak, nonatomic) IBOutlet UILabel *repairStye;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *phoneNumLabel;

@end
@implementation CHWXQYCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.headImgView.layer.cornerRadius = 5;
    self.headImgView.layer.masksToBounds = YES;
    self.titleLabel.textColor = [UIColor colorWithHexString:@"333333" alpha:1.0f];
    self.addressLabel.textColor = [UIColor colorWithHexString:@"888888" alpha:1.0f];
    self.magorbrandsLabel.textColor =  [UIColor colorWithHexString:@"888888" alpha:1.0f];
    self.repairStye.textColor = [UIColor colorWithHexString:@"148ec7" alpha:1.0f];
    self.nameLabel.textColor = [UIColor colorWithHexString:@"888888" alpha:1.0f];
    self.phoneNumLabel.textColor = [UIColor colorWithHexString:@"888888" alpha:1.0f];
    self.magorbrandsLabel.text = @"11111";
    
}

+(instancetype)cellForTableView:(UITableView *)tableView{
    static NSString *ID = @"repairCell";
    CHWXQYCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle]loadNibNamed:@"CHWXQYCell" owner:nil options:nil] lastObject];
    }
    return cell;
}

-(void)setModel:(QY_Model *)model{
    
    _model = model;
    self.titleLabel.text = model.name;
    self.addressLabel.text =[NSString stringWithFormat:@"地址：%@", model.address];
    self.nameLabel.text = model.legalname;
    self.phoneNumLabel.text = model.legaltel;
    [self.headImgView sd_setImageWithURL:[NSURL URLWithString:model.companyphoto] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    NSString *str = nil;
    if ([model.levels isEqualToString:@"01"]) {
        str = @"一类维修经营业务";
    }else if([model.levels isEqualToString:@"02"]){
        str = @"二类维修经营业务";
    }else if([model.levels isEqualToString:@"03"]){
        str = @"三类维修经营业务";
    }else{
        str = @"其他";
    }
    self.repairStye.text = str;
    
    if (model.magorbrands.length <= 0) {
        self.magorbrandsLabel.text = @"维修品牌：综合品牌";
    }else{
        self.magorbrandsLabel.text = [NSString stringWithFormat:@"维修品牌：%@", model.magorbrands];
    }
    
    
}

@end
